/**
 * @author nttdocomo
 */
define(function(require) {
	//aries.augmentString('aries.templates.base',_.template('<div></div>'));
	aries.view("aries.views.Base", Backbone.View.extend({
        attach: function (a) {
            for (var b in a) this[b] = a[b]
        },
        initialize:function(o){
        	this.attach(o)
        },
		toJSON:function(){
			if(this.model){
				return this.model.toJSON();
			}
			return undefined
		},
		render : function(selector, operation) {
			this.selector = selector;
			this.operation = operation || "html";
			this.html()
			if(typeof d == "string")
				this.selector = $(this.selector);
			$(this.selector)[this.operation](this.$el);
			return this.$el
		},
		html : function() {
			var el = document.createElement('div');
			if(!this.constructor._template){
				el.appendChild(this.el);
				return el.innerHTML;
			}
			var html = this.constructor._template(arguments[0] || this.toJSON() || this);
			var el = document.createElement('div');
			el.innerHTML = html;
			this.setElement(el.firstChild)
			this.afterRender();
			return html
		},
        $html: function (options) {
            return $(this.html())
        },
		afterRender:function(){}
	}));
});
